#include "processBar.h"
#include <cstring>
#include <unistd.h>
#include <stdio.h>
const int N = 110;

char str[N];

//v2

void processbar(int rate)
{

    
    if(rate < 0 || rate > 100)
        return;


    printf("[%-100s] [%d%%]\r", str, rate);
    fflush(stdout);
    str[rate++] = STYLE;
    

}

void Bar_distory()
{
    memset(str, '\0',sizeof(str));
}

//版本1
/*
void processbar()
{
    memset(str, '\0', sizeof(str));

    int cnt = 0;

    while(cnt <= 100)
    {
        printf("[%-100s] [%d%%]\r", str, cnt);
        fflush(stdout);
        str[cnt++] = STYLE;
        usleep(100000);
    }
    printf("\n");
}
*/
